Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 23: Adding Fog

../ch23/23fig05.gif
Figure 23.5

Fog and backgrounds bound and unbound by touching shapes within the world.

23fig05.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
    # Initial fog and background
        Fog {
            color 1.0 1.0 1.0
            fogType "LINEAR"
            visibilityRange 40.0
        },
        Background { skyColor 1.0 1.0 1.0 },
    # Alternate fog background
        DEF AltFog Fog {
            color 1.0 0.0 0.0
            fogType "LINEAR"
            visibilityRange 30.0
        },
        DEF AltBack Background { skyColor 1.0 0.0 0.0 },
    # Test world
        Transform {
            children [
                Inline { url "fogworld.wrl" },
                DEF TouchWorld TouchSensor { }
            ]
        }
    ]
}
ROUTE TouchWorld.isActive TO AltFog.set_bind
ROUTE TouchWorld.isActive TO AltBack.set_bind